import { ref } from "vue";
import { defineStore } from "pinia";

export const useOauthStore = defineStore("oauthStore", () => {
  const user = ref({});
  const getUser = async (data: any) => {
    user.value = data;
    localStorage.setItem("user", JSON.stringify(data));
  };
  const clearUser = () => {
    user.value = {};
    localStorage.removeItem("user");
  };
  return {
    user,
    getUser,
    clearUser,
  };
});
